package fr.pub.jamico.junit;

import static org.junit.Assert.assertEquals;

import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.ShortMessage;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import fr.pub.jamico.midi.JamicoMessage;

public class JamicoMessageTestCase {

	private static JamicoMessage jm;
	
	@Before
	public void setUp() throws Exception {
		jm = new JamicoMessage(ShortMessage.NOTE_ON, 0, 0, 0);
	}

	@After
	public void tearDown() throws Exception {
	}
	
	@Test
	public void testMessage() {
		assertEquals(jm.getChannel(), 0x00);
		assertEquals(jm.getStatus(), 0x90);
		assertEquals(jm.getLength(), 3);
	}
	
	@Test
	public void testMessageChannel() {
		try{
			jm.setChannel(1);
			assertEquals(jm.getChannel(), 1);
		}
		catch (InvalidMidiDataException imde) {
			imde.printStackTrace();
		}
		
	}

}
